<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>后台管理</title>
	<%--静态包含base标签，css，jQuery文件，--%>
	<%@include file="/view/common/head.jsp"%>
	<style>
		.hidden_scroll{
			/*border: 1px solid red;*/
			height: 370px;
			overflow: hidden;
			width: 985px;
			position: relative;
		}
		.table_div{
			/*border: 1px solid red;*/
			height: 370px;
			overflow-y: auto;
			position: absolute;
			right:-20px;
		}
		#main .table_div table{
			margin-top: 10px;
		}
		.width_tr>th{
			font-size: 22px;
			width: 140px !important;
		}
		.width_tr>th:last-child{
			width: 280px !important;
			/*padding-right: 20px;*/
		}
		.width_td{
			width:75px !important;
		}
	</style>
	<script type="text/javascript">
		$(function (){
			$(".deleteClass").click(function (){
				return confirm("你确定要删除【" + $(this).parent().parent().find("td:first").text() + "】?");
			})
			$("#searchPageBtn").click(function (){
				let pageNo = $("#pn_input").val();
				<%--location.href = "${requestScope.basePate}${requestScope.page.url}&pageNo=" + pageNo;--%>

				<%--if(pageNo > ${requestScope.page.pageTotal}){--%>
				<%--	pageNo = ${requestScope.page.pageTotal};--%>
				<%--}else if(pageNo <= 0){--%>
				<%--	pageNo = 1;--%>
				<%--}--%>
				location.href = "${requestScope.basePate}${requestScope.page.url}&pageNo=" + pageNo;

			});
		});
	</script>
	<Script type="text/javascript">
		$(function () {
			// 给加入购物车按钮绑定单击事件
			$("button.addToList").click(function () {
				var clothesId = $(this).attr("clothesId");
				location.href = "${basePath}listServlet?action=addItem&flag=0&id=" + clothesId;
			});
		});
	</Script>
</head>
<body>
<%@include file="/view/common/back.jsp"%>
	<div id="header">
			<span class="wel_word">后台管理系统</span>
		<%@include file="/view/common/manager_menu.jsp"%>
	</div>


	<div style="text-align: center;height:58px;">
	<c:if test="${empty sessionScope.cl_list.items}">
		<%--                如果出库列表为空--%>
		<span style="display: inline-block; height: 21.6px; width:185px;"></span>
		<div>
			<span> </span>
			<span style="color: red">出库列表为空</span>
		</div>
	</c:if>
	<c:if test="${ not empty sessionScope.cl_list.items}">
		<%--                如果出库列表不为空--%>
		<span>您的出库列表中有${sessionScope.cl_list.totalCount}件商品</span>
		<div>
			您刚刚将<span style="color: red">${sessionScope.cl_lastname}</span>加入到了出库中
		</div>
	</c:if>

</div>
	<div id="main" style="	margin-top: -60px;">
		<table>
			<tr class="width_tr">
				<th>名称</th>
				<th>类别</th>
				<th>价格</th>
				<th>销量</th>
				<th>库存</th>
				<th colspan="3">操作</th>
			</tr>
<%--			<tr>--%>
<%--				<td></td>--%>
<%--				<td></td>--%>
<%--				<td></td>--%>
<%--				<td></td>--%>
<%--				<td></td>--%>
<%--				<td></td>--%>
<%--				<td><a href="view/manage/clothes_edit.jsp?pageNo=${requestScope.page.pageTotal}">添加图书</a></td>--%>
<%--			</tr>--%>
		</table>
		<div class="hidden_scroll">
			<div class="table_div">
				<table>
					<tr>
						<th></th>
						<th></th>
						<th></th>
						<th></th>
						<th></th>
						<th colspan="3"></th>
					</tr>
					<c:forEach items="${requestScope.clothess}" var="clothes">
						<tr>
							<td>${clothes.name}</td>
							<td>${clothes.kind}</td>
							<td>${clothes.price}</td>
							<td>${clothes.sales}</td>
							<td>${clothes.stock}</td>
							<td class="width_td"><a href="manage/clothesServlet?action=getClothes&id=${clothes.id}">修改</a></td>
							<td class="width_td"><a class="deleteClass" href="manage/clothesServlet?action=delete&id=${clothes.id}">删除</a></td>
							<td class="width_td"> <button clothesId="${clothes.id}" class="addToList">出库</button></td>
						</tr>
					</c:forEach>
				</table>

			</div>
		</div>

	</div>

	<%@include file="/view/common/page_nav.jsp"%>
	</div>
<%@include file="/view/common/footer.jsp"%>
</body>
</html>